﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using UTable.Input;
using UTable.Input.MultiTouch;
using UTable.Objects;
using UTable.Objects.Controls;
using System.Collections.ObjectModel;

namespace UTable.Objects
{
    /// <summary>
    /// Interaction logic for ChooseShareTargetDialog.xaml
    /// </summary>
    public partial class ChooseShareTargetDialog : UDialog
    {

        public ObservableCollection<String> WorkspaceList = new ObservableCollection<String>();

        public ChooseShareTargetDialog()
        {
            InitializeComponent();

            TargetList.ItemsSource = WorkspaceList;
        }

        private void UButton_Pressed(object sender, ButtonEventArgs args)
        {
            this.Close();

            String str = (sender as UButton).DataContext as String;
            int id  = int.Parse(str.Substring(str.Length - 1));

            if (TargetShareChoosed != null)
                TargetShareChoosed(id);
        }

        public event ChooseShareTargetDialogHandler TargetShareChoosed;
    }

    public delegate void ChooseShareTargetDialogHandler(int choosedId);
}
